/*
 * @Author: 孙大大
 * @Date: 2022-04-09 19:45:49
 * @LastEditTime: 2022-04-13 11:13:41
 * @FilePath: \黑马面面\src\api\questions.js
 */
import request from "@/utils/request";

export function getQuestionList(data) {
  return request({
    url: `/questions?${data}`,
    method: "get",
  });
}

export function changePages(params) {
  return request({
    url: "/questions",
    method: "get",
    params,
  });
}

export function getFormList() {
  return request({
    url: "/subjects/simple",
    method: "get",
  });
}

export function getCatalogList(data) {
  return request({
    url: `/directorys/simple?subjectID=${data}`,
    method: "get",
  });
}

export function getTagsList(data) {
  return request({
    url: `/tags/simple?subjectID=${data}`,
    method: "get",
  });
}

export function delRow(data) {
  return request({
    url: `/questions/${data}`,
    method: "DELETE",
  });
}

export function checkState(params) {
  return request({
    url: "/questions/choice",
    method: "GET",
    params,
  });
}

export function GetList(data) {
  return request({
    url: `/questions/choice?${data}`,
    method: "GET",
  });
}

export function check(id, data) {
  return request({
    url: `/questions/check/${id}`,
    method: "POST",
    data,
  });
}

// 上架题目
export function xiaJia(a, b, data) {
  return request({
    url: `/questions/choice/${a}/${b}`,
    method: "POST",
    data,
  });
}

export function deleteQuestion(id, data) {
  return request({
    url: `/questions/${id}`,
    method: "DELETE",
    data,
  });
}

// export function getRandoms() {
//   return request({
//     url: "/questions/randoms",
//     method: "get",
//   });
// }

export function addJIN(a, b, data) {
  return request({
    url: `/questions/choice/${a}/${b}`,
    method: "PATCH",
    data,
  });
}

// 拿到试题录入的学科数据
export function getSubjects() {
  return request({
    url: "/subjects",
    method: "get",
  });
}

// 拿到试题录入的目录数据
export function getMune(data) {
  return request({
    url: `/directorys?subjectID=${data}`,
    method: "get",
  });
}

// 拿到试题录入的标签数据
export function getTags(data) {
  return request({
    url: `/tags?subjectID=${data}`,
    method: "get",
  });
}

// 拿到公司数据列表
export function getCompany() {
  return request({
    url: "/companys",
    method: "get",
  });
}

// 添加试题（试题录入）
export function addQusetions(data) {
  return request({
    url: "/questions",
    method: "post",
    data,
  });
}
